package test;

import adapter.Duck;
import adapter.MallardDuck;
import adapter.TurkeyAdapter;
import adapter.WildTurkey;

public class AdapterMain {
    public static void main(String[] args) {
        MallardDuck duck = new MallardDuck();
        WildTurkey turkey = new WildTurkey();

        Duck turkeyAdapter = new TurkeyAdapter(turkey);
        System.out.println("执行火鸡");
        turkey.gobble();
        turkey.fly();
        System.out.println("执行鸭子");
        testDuck(duck);
        System.out.println("执行火鸡适配器");
        testDuck(turkeyAdapter);
    }

    static void testDuck(Duck duck) {
        duck.quack();
        duck.fly();
    }
}
